package com.offer;

/**
 * @Author: huangzhigao
 * @Date: 2023/3/4 17:29
 */
public class offer21 {
    public int[] exchange(int[] nums) {
        int left = 0;
        int right = nums.length - 1;
        while (left < right) {
            if (nums[left] % 2 == 1) {
                left++;
            } else {
                int tmp = nums[left];
                nums[left] = nums[right];
                nums[right] = tmp;
                right--;
            }
        }
        return nums;
    }

}
